package com.camtc.camcenter.custom;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.camtc.camcenter.common.CamConstants;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.text.MessageFormat;

/**
 * <p>
 *
 * </p>
 *
 * @author chentianshun
 * @since 2021-07-20
 */

@AllArgsConstructor
public enum MessageInfoEnum {

    /**
     * 消息体
     */
    INSERT_INFO("新增成功"),
    UPDATE_INFO("修改成功"),
    DELETE_INFO("删除成功");

    /**
     * 消息主题
     */
    @Getter
    private final String message;

    /**
     * 补充消息
     *
     * @param supInfo 补充消息
     * @return
     */
    public String supplementMseeage(Object... supInfo) {
        if (!this.message.matches(CamConstants.CHECK_INFO_REG) || supInfo.length == 0) {
            return this.message;
        }
        return MessageFormat.format(this.message, supInfo);
    }
}
